//
//  FQDSegmentedControl.h
//  FakeQDaily
//
//  Created by mewxiv on 9/20/16.
//  Copyright © 2016 Xensius. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, FQDSegmentedControlSelectIndicatorWidthStyle) {
    FQDSegmentedControlSelectIndicatorWidthStyleFixed,      // select indicator's width is fixed
    FQDSegmentedControlSelectIndicatorWidthStyleDynamic,    // select indicator's width is as long as text width
};

typedef void(^SelectedIndexChangedBlock)(NSInteger idx);

@interface FQDSegmentedControl : UIControl

@property (nonatomic, strong) NSArray *sectionTitles;
@property (nonatomic, assign) NSInteger selectedSegmentIndex;
@property (nonatomic, strong) UIColor *backgroundColor;
@property (nonatomic, strong) UIColor *selectIndicatorColor;
@property (nonatomic, assign) CGFloat selectLineIndicatorHeight;
@property (nonatomic, strong) NSDictionary *sectionTitleAttributes;
@property (nonatomic, strong) NSDictionary *selectedSectionTitleAttributes;
@property (nonatomic, copy) SelectedIndexChangedBlock selectedIndexChangedBlock;

// Used to specify the selector indicator's width style
// Defaults to FQDSegmentedControlSelectIndicatorWidthStyleFixed
@property (nonatomic, assign) FQDSegmentedControlSelectIndicatorWidthStyle selectIndicatorWidthStyle;
// Used to specify the ratio of the select indicator's width to section width when indicator's width is fixed
// Defaults to 0.5
@property (nonatomic, assign) CGFloat selectIndicatorFixedWidthRatio;

- (void)setSelectedIndexChangedBlock:(SelectedIndexChangedBlock)selectedIndexChangedBlock;
@end
